<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
	function checkForm() {
		var dname = document.getElementById("dname").value;
		var price = document.getElementById("price").value;
		var img = document.getElementById("img").value;
		if (dname == null || dname == "") {
			document.getElementById("dnamerror").innerHTML = "类型不能为空！";
			return false;
		}
		if (price == null || price == "") {
			document.getElementById("priceerror").innerHTML = "地址不能为空！";
			return false;
		}
		if (img == null || img == "") {
			document.getElementById("imgerror").innerHTML = "个人详情不能为空！";
			return false;
		}
		return true;
	}
</script>
</head>
<body>
<form class="upload-form" action="${pageContext.request.contextPath }/dish?action=save" onsubmit="return checkForm()"
				method="post" enctype="multipart/form-data" >
				<h3>Upload Dish</h3>
	<div class="form-group">
		<label>菜品名称</label> <input type="text" class="form-control"
			id="dname" name="dname" placeholder="请输入菜品名称"><span id="dnamerror" color="red"></span>
	</div>
	<div class="form-group">
		<label>价格</label> <input type="number" class="form-control"
			id="price" name="price" placeholder="菜品价格 ：元/份" ><span id="priceerror" color="red"></span>
	</div>
	<div class="form-group">
		<label>上传图片</label> <input type="file" id="img" name="img"><span id="imgerror" color="red"></span>
	</div>
	<div class="form-group btn-center">
		<button type="submit" class="btn btn-primary sub-btn">提交</button>
		<button type="reset" class="btn btn-primary sub-btn">重置</button>
	</div>
</form>

</body>
</html>